package domain;

import domain.exceptions.CannotFlagSquareException;
import domain.exceptions.CannotPlaceAgentHereException;

/**
 *
 * @author shaigi
 */
public class SquareIce extends Square{

    public SquareIce(int row, int column){
        setAgent(null);
        setRow(row);
        setColumn(column);
        try {
			setFlag(null);
		} catch (CannotFlagSquareException e) {
			e.printStackTrace();
		}
    }

    public SquareIce(SquareIce other){
        setAgent(null);
        setRow(other.getRow());
        setColumn(other.getColumn());
        try {
        	if (other.getFlag() != null)
        		setFlag(new Flag (other.getFlag()));
        	else
        		setFlag(null);
		} catch (CannotFlagSquareException e) {
			e.printStackTrace();
		}
    }
    
    @Override
    public String toString(){
        return "Ice Square " + toStringLocation();
    }

    @Override
    public void placeAgent(Agent agent) throws CannotPlaceAgentHereException {
    	if (isThereAgentHere())
    		throw new CannotPlaceAgentHereException();
//        try {
//            agent.getSquare().removeAgent();
//        } catch (Exception ex) {
//            System.out.println(ex.getMessage());
//        }
        setAgent(agent);
    }
    
}

